//创建前端服务层JS
msqbapp.service('msqbService',function ($http) {
    //发送获取短信验证码的http请求
    this.getSMSCode = function (telNumber) {
        return $http.get(basepath+'smsservice/sendsms.do?phoneNum='+telNumber);
    }
    //发送用户注册http请求
    this.register = function (smscode,userBean) {
        alert(userBean.telNumber);
        return $http.post(basepath+'user/add.do?smscode='+smscode,userBean);
    };
    //发送用户登录http请求
    this.login = function (userBean) {
        return $http.post(basepath+'login/login.do',userBean);
    };
    //根据用户ID查询一个用户信息对象的http请求
    this.findOne = function (userId) {
        return $http.get(basepath+'user/findOne.do?id='+userId);
    };
    //发送查询岗位信息列表的http请求
    this.getJobAll = function () {
        return $http.get(basepath+'job/getJobAll.do');
    };
    //发送完善个人信息的http请求
    this.updateUser = function (userBean) {
        return $http.post(basepath+'user/update.do?id=',userBean);
    };
    //发送得到一级分类列表的http请求
    this.classifyOneList = function (classifyParentId) {
        return $http.get(basepath+'classify/findClassifyListByClassifyParentId.do?classifyParentId='+classifyParentId);
    };
    //发送当前用户所选择的一级分类标签的最近阅读题目列表的http请求
    this.getRecentTopic = function (userId,classifyId) {
        return $http.get(basepath+'topic/getRecentReadTopic.do?userId='+userId+'&classifyId='+classifyId);
    };
    //发送读取热推题目列表的http请求
    this.getMostTopic = function (classifyId) {
        return $http.get(basepath+'topic/getMostTopic.do?classifyId='+classifyId);
    };
    //发送得到最新题目列表的http请求
    this.getNewTopic = function (classifyId) {
        return $http.get(basepath+'topic/getNewTopic.do?classifyId='+classifyId);
    };
    //发送得到题型列表的http请求
    this.getTopicTypeNumList = function (classifyId) {
        return $http.get(basepath+'topic/getTopicTypeNumList.do?classifyId='+classifyId);
    };
    //发送得到标签列表的http请求
    this.getTagTypeBeanList=function (classifyId,userId) {
        return $http.get(basepath+'topic/getTagTypeBeanList.do?userId='+userId+'&classifyId='+classifyId);
    };
    //发送得到收藏题目列表的http请求
    this.getStoreTopicList=function (classifyId,userId) {
        return $http.get(basepath+'topic/getStoreTopicList.do?userId='+userId+'&classifyId='+classifyId);
    };
    //发送得到已读题目列表的http请求
    this.getReadTopicList=function (classifyId,userId) {
        return $http.get(basepath+'topic/getReadTopicList.do?userId='+userId+'&classifyId='+classifyId);
    };
    //发送得到对应的阅读状态得到指定阅读状态题目列表的http请求
    this.getReadTagTopicList=function (classifyId,userId,tagFlag) {
        return $http.get(basepath+'topic/getReadTagTopicList.do?userId='+userId+'&classifyId='+classifyId+"&tagFlag="+tagFlag);
    };
    //发送得到对应的阅读状态得到指定阅读状态题目列表的http请求
    this.getTopicBeanList=function (classifyId,topictypeid) {
        return $http.get(basepath+'topic/getTopicBeanList.do?classifyId='+classifyId+'&topicType='+topictypeid);
    };
    //发送读取集体题目的http请求
    this.getTopicItem=function (userId,topicId) {
        return $http.get(basepath+'topic/getTopicObject.do?userId='+userId+'&topicId='+topicId);
    };
    //发送读取集体题目答案的http请求
    this.getAnswer=function (topicId) {
        return $http.get(basepath+'answer/getAnswerBean.do?topicId='+topicId);
    };
    //发送读修改阅读状态的http请求
    this.updateReadLogStatus=function (userId,topicId,readLogStatus) {
        return $http.get(basepath+'readlog/updateReadLogStatus.do?userId='+userId+'&topicId='+topicId+'&readLogStatus='+readLogStatus);
    };
    //发送读读取评论列表的http请求
    this.getCommentBeanList=function (topicId) {
        return $http.get(basepath+'comment/getCommentBeanList.do?topicId='+topicId);
    };
    //发送添加评论信息的http请求
    this.addComment=function (commentBean) {
        return $http.post(basepath+'comment/add.do',commentBean);
    };
    //发送查看具体题目是否被收藏
    this.isShouCang=function (userId,topicId){
        return $http.get(basepath+'/store/isShouCang.do?userId='+userId+'&topicId='+topicId);
    };
    this.addStore=function (storebean) {
        return $http.post(basepath+'store/add.do',storebean);
    }
    this.changeStore=function (userId,topicId) {
        return $http.get(basepath+'store/changeStoreStatus.do?userId='+userId+'&topicId='+topicId);
    }
});